#include<iostream>
#include<cstring>
#include<map>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
using namespace std;
const int maxn = 171115;
string a;
map<string,string> key;
vector<string> an;

int to10(int start){
    long long ans = 0;
    for(int i=7;i>=0;i--){
        ans+=(a[start+7-i]-'0')*pow(2,i);
    }
    return ans;
}

void init(){
    key["10100000"]="A";
    key["10100001"]="B";
    key["10100010"]="C";
    key["10100011"]="D";
    key["10100100"]="E";
    key["10100101"]="F";
    key["10100110"]="G";
    key["10100111"]="H";
    key["10101000"]="I";
    key["10101001"]="J";
    key["10101010"]="K";
    key["10101011"]="L";
    key["10101100"]="M";
    key["10101101"]="N";
    key["10101110"]="O";
    key["10101111"]="P";
    key["10110000"]="Q";
    key["10110001"]="R";
    key["10110010"]="S";
    key["10110011"]="T";
    key["10110100"]="U";
    key["10110101"]="V";
    key["10110110"]="W";
    key["10110111"]="X";
    key["10111000"]="Y";
    key["10111001"]="Z";
}

int main(){
    cin>>a;
    int num=0;
    if(a.size()%8!=0){
        cout<<"Error"<<endl;
        return 0;
    }else{
        num=a.size()/8;
    }
    init();
    long long ac=0;
    int wa=0;
    bool flag = false;
    for(int i=0;i<=a.size();i++){
    	if(a[i]-'0'>1){
    		cout<<"Error"<<endl;
    		return 0;
    	}
    }
    for(int i=0;i<num;i++){
        if(a[i*8]=='1' && a[i*8+1]=='0' && a[i*8+2]=='1' && flag==false){
            string tmp=a.substr(i*8,8);
            string ss = key[tmp];
            an.push_back(ss);
        }else if(a[i*8]=='0' && flag==false){
            ac = to10(i*8);
            ac/=2;
            wa++;
            flag = true;
        }else if(a[i*8]=='1' && a[i*8+1]=='1' && a[i*8+2]=='1' && flag==false){
            an.push_back(" ");			
        }else if(flag==true && a[i*8]=='0'){
            wa++;
            an.push_back(to_string(to10(i*8)/2 + ac));
            flag=false;
        }else if((a[i*8]=='1' && a[i*8+1]=='1' && a[i*8+2]=='1' && flag==true) || (a[i*8]=='1' && a[i*8+1]=='0' && a[i*8+2]=='1' && flag==true)||(a[i*8]=='0' && flag==true)){
            wa = 1;
            break;
        }else{
        	cout<<"Error"<<endl;
        	return 0;
        }
    }
    if(wa%2 != 0)cout<<"Error"<<endl; 
    else{
        for(int i=0;i<an.size();i++){
            cout<<an[i];
        }
    }
    cout<<endl;
    return 0;
}

